<?php 
namespace Home\Controller;
use Think\Controller;
class CommonController extends Controller {
   public function _initialize()
   {

   		$auth_rule = C('AUTH_RULE');

   		$path = CONTROLLER_NAME.'/'.ACTION_NAME;

   		if(in_array($path, $auth_rule)){
   			if(!isset($_SESSION['uid'])){
    			$this->error('你还没有登录，请先登录',U('home/login/index'));
    		}
   		}  		
   }

   public function gettop()
   {
      $sql ='select count(t2.id),t1.face,t1.nikename,t1.id from user t1 join answer t2 on t1.id = t2.uid group by t2.uid order by count(t2.id) desc limit 3';
       $top = M()->query($sql);
       S('top',$top,86400);
        $a = S('top');
        return $a;

   }

}



 ?>